require 'redis'

r = Redis.new(host: "192.168.3.91", port: 6379, db: 15)

RandomPushScript = <<EOF
    local i = tonumber(ARGV[1])
    local res
    while (i > 0) do
        res = redis.call('LPUSH',KEYS[1],math.random())
        i = i-1
    end
    return res
EOF

RandomPushScript2 = <<EOF
    local i = tonumber(ARGV[1])
    return i
EOF

RandomPushScript3 = <<EOF
    return ARGV[2]
EOF

r.del(:mylist)
puts rand(2**32)
puts [10,rand(2**32)]
puts r.eval(RandomPushScript,[:mylist],[4])
puts r.eval(RandomPushScript2,[:mylist],[4])
puts r.eval(RandomPushScript3,[:mylist],[10,23,rand(2**32)])
